home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsIWindowWatcher.idl < prev    next >
Text File  |  2006-05-08  |  8KB  |  191 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2.  *
  3.  * ***** BEGIN LICENSE BLOCK *****
  4.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  5.  *
  6.  * The contents of this file are subject to the Mozilla Public License Version
  7.  * 1.1 (the "License"); you may not use this file except in compliance with
  8.  * the License. You may obtain a copy of the License at
  9.  * http://www.mozilla.org/MPL/
  10.  *
  11.  * Software distributed under the License is distributed on an "AS IS" basis,
  12.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13.  * for the specific language governing rights and limitations under the
  14.  * License.
  15.  *
  16.  * The Original Code is mozilla.org code.
  17.  *
  18.  * The Initial Developer of the Original Code is
  19.  * Netscape Communications, Inc.
  20.  * Portions created by the Initial Developer are Copyright (C) 2001
  21.  * the Initial Developer. All Rights Reserved.
  22.  *
  23.  * Contributor(s):
  24.  *
  25.  * Alternatively, the contents of this file may be used under the terms of
  26.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  27.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  28.  * in which case the provisions of the GPL or the LGPL are applicable instead
  29.  * of those above. If you wish to allow use of your version of this file only
  30.  * under the terms of either the GPL or the LGPL, and not to allow others to
  31.  * use your version of this file under the terms of the MPL, indicate your
  32.  * decision by deleting the provisions above and replace them with the notice
  33.  * and other provisions required by the GPL or the LGPL. If you do not delete
  34.  * the provisions above, a recipient may use your version of this file under
  35.  * the terms of any one of the MPL, the GPL or the LGPL.
  36.  *
  37.  * ***** END LICENSE BLOCK ***** */
  38.  
  39. /**
  40.  * nsIWindowWatcher is the keeper of Gecko/DOM Windows. It maintains
  41.  * a list of open top-level windows, and allows some operations on them.
  42.  
  43.  * Usage notes:
  44.  
  45.  *   This component has an |activeWindow| property. Clients may expect
  46.  * this property to be always current, so to properly integrate this component
  47.  * the application will need to keep it current by setting the property
  48.  * as the active window changes.
  49.  *   This component should not keep a (XPCOM) reference to any windows;
  50.  * the implementation will claim no ownership. Windows must notify
  51.  * this component when they are created or destroyed, so only a weak
  52.  * reference is kept. Note that there is no interface for such notifications
  53.  * (not a public one, anyway). This is taken care of both in Mozilla and
  54.  * by common embedding code. Embedding clients need do nothing special
  55.  * about that requirement.
  56.  *   This component must be initialized at application startup by calling
  57.  * setWindowCreator.
  58.  *
  59.  * @status FROZEN
  60.  */
  61.  
  62. #include "nsISupports.idl"
  63.  
  64. interface nsIDOMWindow;
  65. interface nsIObserver;
  66. interface nsIPrompt;
  67. interface nsIAuthPrompt;
  68. interface nsISimpleEnumerator;
  69. interface nsIWebBrowserChrome;
  70. interface nsIWindowCreator;
  71.  
  72. [scriptable, uuid(002286a8-494b-43b3-8ddd-49e3fc50622b)]
  73.  
  74. interface nsIWindowWatcher : nsISupports {
  75.  
  76.   /** Create a new window. It will automatically be added to our list
  77.       (via addWindow()).
  78.       @param aParent parent window, if any. Null if no parent.  If it is
  79.              impossible to get to an nsIWebBrowserChrome from aParent, this
  80.              method will effectively act as if aParent were null.
  81.       @param aURL url to which to open the new window. Must already be
  82.              escaped, if applicable. can be null.
  83.       @param aName window name from JS window.open. can be null.
  84.       @param aFeatures window features from JS window.open. can be null.
  85.       @param aArguments extra argument(s) to the new window, to be attached
  86.              as the |arguments| property. An nsISupportsArray will be
  87.              unwound into multiple arguments (but not recursively!).
  88.              can be null.
  89.       @return the new window
  90.   */
  91.   nsIDOMWindow openWindow(in nsIDOMWindow aParent, in string aUrl,
  92.                in string aName, in string aFeatures,
  93.                in nsISupports aArguments);
  94.  
  95.   /** Clients of this service can register themselves to be notified
  96.       when a window is opened or closed (added to or removed from this
  97.       service). This method adds an aObserver to the list of objects
  98.       to be notified.
  99.       @param aObserver the object to be notified when windows are
  100.                        opened or closed. Its Observe method will be
  101.                        called with the following parameters:
  102.  
  103.       aObserver::Observe interprets its parameters so:
  104.       aSubject the window being opened or closed, sent as an nsISupports
  105.                which can be QIed to an nsIDOMWindow.
  106.       aTopic   a wstring, either "domwindowopened" or "domwindowclosed".
  107.       someData not used.
  108.   */
  109.   void registerNotification(in nsIObserver aObserver);
  110.  
  111.   /** Clients of this service can register themselves to be notified
  112.       when a window is opened or closed (added to or removed from this
  113.       service). This method removes an aObserver from the list of objects
  114.       to be notified.
  115.       @param aObserver the observer to be removed.
  116.   */
  117.   void unregisterNotification(in nsIObserver aObserver);
  118.  
  119.   /** Get an iterator for currently open windows in the order they were opened,
  120.       guaranteeing that each will be visited exactly once.
  121.       @return an enumerator which will itself return nsISupports objects which
  122.               can be QIed to an nsIDOMWindow
  123.   */
  124.  
  125.   nsISimpleEnumerator getWindowEnumerator();
  126.  
  127.   /** Return a newly created nsIPrompt implementation.
  128.       @param aParent the parent window used for posing alerts. can be null.
  129.       @return a new nsIPrompt object
  130.   */
  131.  
  132.   nsIPrompt getNewPrompter(in nsIDOMWindow aParent);
  133.  
  134.   /** Return a newly created nsIAuthPrompt implementation.
  135.       @param aParent the parent window used for posing alerts. can be null.
  136.       @return a new nsIAuthPrompt object
  137.   */
  138.  
  139.   nsIAuthPrompt getNewAuthPrompter(in nsIDOMWindow aParent);
  140.  
  141.   /** Set the window creator callback. It must be filled in by the app.
  142.       openWindow will use it to create new windows.
  143.       @param creator the callback. if null, the callback will be cleared
  144.                      and window creation capabilities lost.
  145.   */
  146.   void setWindowCreator(in nsIWindowCreator creator);
  147.  
  148.  
  149.   /** Retrieve the chrome window mapped to the given DOM window. Window
  150.       Watcher keeps a list of all top-level DOM windows currently open,
  151.       along with their corresponding chrome interfaces. Since DOM Windows
  152.       lack a (public) means of retrieving their corresponding chrome,
  153.       this method will do that.
  154.       @param aWindow the DOM window whose chrome window the caller needs
  155.       @return the corresponding chrome window
  156.   */
  157.   nsIWebBrowserChrome getChromeForWindow(in nsIDOMWindow aWindow);
  158.  
  159.   /**
  160.       Retrieve an existing window (or frame).
  161.       @param aTargetName the window name
  162.       @param aCurrentWindow a starting point in the window hierarchy to
  163.                             begin the search.  If null, each toplevel window
  164.                             will be searched.
  165.  
  166.       Note: This method will search all open windows for any window or
  167.       frame with the given window name. Make sure you understand the
  168.       security implications of this before using this method!
  169.   */
  170.   nsIDOMWindow getWindowByName(in wstring aTargetName,
  171.                                in nsIDOMWindow aCurrentWindow);
  172.  
  173.   /** The Watcher serves as a global storage facility for the current active
  174.       (frontmost non-floating-palette-type) window, storing and returning
  175.       it on demand. Users must keep this attribute current, including after
  176.       the topmost window is closed. This attribute obviously can return null
  177.       if no windows are open, but should otherwise always return a valid
  178.       window.
  179.   */
  180.   attribute nsIDOMWindow activeWindow;
  181.  
  182. };
  183.  
  184. %{C++
  185. // {002286a8-494b-43b3-8ddd-49e3fc50622b}
  186. #define NS_WINDOWWATCHER_IID \
  187.  {0x002286a8, 0x494b, 0x43b3, {0x8d, 0xdd, 0x49, 0xe3, 0xfc, 0x50, 0x62, 0x2b}}
  188.  
  189. #define NS_WINDOWWATCHER_CONTRACTID "@mozilla.org/embedcomp/window-watcher;1"
  190. %}
  191.